#pragma once
#include <string>
using std::string;
using std::wstring;

namespace osg
{
#if _DEBUG
#define throw_error(type, text) throw type(text, __FILE__ "#" __LINE__)
#define throw_error(type, text, err) throw type(text, err, __FILE__ "#" __LINE__)
#else
#define throw_error(type, text) throw type(text, "")
#define throw_error(type, text, err) throw type(text, err, "")
#endif

	template <class T>
	class error_t
	{
	public:
		error_t(const wstring& text, const string& pos)
		{

		}
		error_t(const wstring& text, const error_t& err, const string& pos)
			: m_text(text)
		{

		}
	public:
		const wstring& message() const
		{
			return m_text;
		}
		const wstring& trace() const
		{
			// TODO:
			return m_text;
		}

	protected:
		static error empty;

	private:
		const wstring& m_text;
		const error_t& m_err;
		const string& m_pos;
	};

	typedef error_t<void*> error;
}